<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="/template/page_config.jsp" %>
<style type="text/css">
.productCreation tr {
	height: 30px;
}
.filter {
	float:left;
	width:100%;
	border-bottom:1px solid #C6C6C6;
}
</style>
<script type="text/javascript">
    function confirm(){
        var name=document.getElementById("name");
        var price=document.getElementById("price");
        var note=document.getElementById("note");
        if(name.value==""){
            alert("${el:getLang('name_empty', LANG) }");
        }else if(price.value=="" || !validateNumber(price.value)){
            alert("${el:getLang('price_empty', LANG) }");
        }else if(note.value==""){
            alert("${el:getLang('note_empty', LANG)}");
        }else{
            document.forms["frm"].submit();
        } 
    }
    function validate(){
        
    }
    function validateNumber(str){
    var temp = "0123456789";
    var x=str;
    var i;
    for (i = 0; i < x.length; i++) {
        var j;
        for (j = 0; j < temp.length; j++) {
            if (temp.charAt(j) == x.charAt(i)) {
                j = temp.length;
            }
        }

        if (j != temp.length + 1) {
            i = x.length;
        }
    }
    if (i == x.length+ 1) {
        return false;
    }
    return true;
}
</script>
<form action="/demo/${LANG}/create_product/display?act=create" name="frm" id="frm" method="post">
  <div class="page_content">
  <div class="subject_content">
    <div class="title">${el:getLang("create_product",LANG)}</div>
  </div>
  <div class="data_content">
    <div class="block_content">
      <div style="float:left">
          <c:if test="${requestScope.messages eq '1' }" >
              <div><a>${el:getLang("success", LANG)}</a></div>
          </c:if>
        <table class="productCreation">
          <tr>
            <td width="100px;">${el:getLang("product_name",LANG)} ${el:getLang("required_field",LANG)}:</td>
            <td><input type="text" style="width:300px" name="name" id="name"/></td>
          </tr>
          <tr>
            <td>${el:getLang("price",LANG)} ${el:getLang("required_field",LANG)}:</td>
            <td><input type="text" name="price" id="price"/></td>
          </tr>
         <tr>
            <td>${el:getLang("note",LANG)} ${el:getLang("required_field",LANG)}:</td>
            <td><input type="text" name="note" id="note"/></td>
          </tr>
        </table>
      </div>
     
        </div>
        <div style="float:left;width:100%;text-align:right;margin-top:50px;"> <a onclick="confirm();" class="confirm_button" style="margin-right:20px">${el:getLang('confirm',LANG)}</a> </div>
      </div>
    </div>
</form>